﻿
Partial Class Dialogos_frmPopUpBusquedaArticulos
    Inherits System.Web.UI.Page
    'Private oDvArticulos As DataView
    'Private oDsArticulos As New DataSet
    'Private oConfig As New AppSettingsReader

    'Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    '    If Not Page.IsPostBack Then
    '        Response.Cache.SetCacheability(HttpCacheability.NoCache)
    '        Response.Cache.SetExpires(DateTime.Now().Subtract(New TimeSpan(1, 0, 0)))
    '        Response.Cache.SetLastModified(DateTime.Now)
    '        Response.Cache.SetAllowResponseInBrowserHistory(False)
    '        Session.Timeout = 1000
    '        fnRecuperarValoresURL()
    '        fnCargarCombosClasificacion()
    '        fnCargarArticulos()
    '        Me.tblAvanzada.Visible = False
    '    End If
    '    Me.lblMensaje.Text = ""
    'End Sub

    'Private Sub fnRecuperarValoresURL()
    '    If Request.QueryString("Articulo") Is Nothing Then
    '        Me.txtArticulo.Text = String.Empty
    '    Else
    '        txtArticulo.Text = Request.QueryString("Articulo")
    '    End If
    '    If Request.QueryString("Compania") Is Nothing Then
    '        hidCompania.Value = String.Empty
    '    Else
    '        hidCompania.Value = Request.QueryString("Compania")
    '    End If

    'End Sub
    'Public Function fnCargarDataSet(ByVal psArticulo As String, ByVal psDescripcion As String, ByVal psTipoArticulo As String, ByVal psClasificacion1 As String, ByVal psClasificacion2 As String, ByVal psClasificacion3 As String, ByVal numClasificacion1 As Integer, ByVal numClasificacion2 As Integer, ByVal numClasificacion3 As Integer) As DataSet
    '    Dim oDs As New DataSet
    '    Dim sError As String
    '    Dim bOk As Boolean

    '    Dim oNegArticulo As New srvNegArticuloNoEstandar.srvNegArticuloNoEstandar
    '    bOk = oNegArticulo.fnListar(1, hidCompania.Value, psArticulo, psDescripcion, psTipoArticulo, numClasificacion1, numClasificacion2, numClasificacion3, psClasificacion1, psClasificacion2, psClasificacion3, oDs, sError)
    '    If Not bOk Then
    '        lblMensaje.Text = sError
    '    End If
    '    Return oDs

    'End Function


    'Private Sub fnLlenaDatos(ByRef numClasificacion1 As Integer, ByRef numClasificacion2 As Integer, ByRef numClasificacion3 As Integer, ByRef psTipoArticulos As String)
    '    If Me.lnkMostrar.Text = "Ocultar" Then
    '        numClasificacion1 = Me.ddlClasificacion1.SelectedIndex()
    '        numClasificacion2 = Me.ddlClasificacion2.SelectedIndex()
    '        numClasificacion3 = Me.ddlClasificacion3.SelectedIndex()
    '        fnConcatenaTipoArticulos(psTipoArticulos)
    '    Else
    '        numClasificacion1 = 0
    '        numClasificacion2 = 0
    '        numClasificacion3 = 0
    '        psTipoArticulos = ""
    '    End If


    'End Sub

    'Private Sub fnCargarArticulos()
    '    Try
    '        Dim psArticulo As String, psDescripcion As String
    '        Dim psClasificacion1, psClasificacion2, psClasificacion3 As String
    '        Dim numClasificacion1, numClasificacion2, numClasificacion3 As Integer
    '        Dim psTipoArticulos As String
    '        psArticulo = txtArticulo.Text.Trim
    '        psDescripcion = txtDescripcion.Text.Trim
    '        psClasificacion1 = Me.txtClasificacion1.Text.Trim
    '        psClasificacion2 = Me.txtClasificacion2.Text.Trim
    '        psClasificacion3 = Me.txtClasificacion3.Text.Trim
    '        fnLlenaDatos(numClasificacion1, numClasificacion2, numClasificacion3, psTipoArticulos)
    '        oDsArticulos = fnCargarDataSet(psArticulo, psDescripcion, psTipoArticulos, psClasificacion1, psClasificacion2, psClasificacion3, numClasificacion1, numClasificacion2, numClasificacion3)
    '        oDvArticulos = oDsArticulos.Tables(0).DefaultView
    '        'Cache("dvw_Articulos") = oDvArticulos
    '        Session("dvw_Articulos") = oDvArticulos
    '        grdArticulos.CurrentPageIndex = 0
    '        EnlazarDatagrid(grdArticulos, oDvArticulos)
    '    Catch ex As Exception
    '        lblMensaje.Text = C_MSG_ERROR_INESPERADO
    '        CreateLogFiles()
    '        ErrorLog(Server.MapPath("Logs/ErrorLog"), ex.Message + ex.StackTrace)
    '    End Try

    'End Sub



    'Private Sub fnConcatenaTipoArticulos(ByRef psTipoArticulos As String)
    '    Dim items As ListItemCollection = Me.chkTipoArticulo.Items()
    '    Dim item As ListItem

    '    psTipoArticulos = ""
    '    For Each item In items
    '        If item.Selected Then

    '            psTipoArticulos = psTipoArticulos + "'" + item.Value + "',"
    '        End If
    '    Next
    '    If psTipoArticulos <> "" Then
    '        psTipoArticulos = psTipoArticulos.Substring(0, psTipoArticulos.Length - 1)
    '    End If
    'End Sub

    'Private Sub fnCargarComboClasificacion(ByRef ddlClasificacion As DropDownList, ByVal dst As DataSet)

    '    ddlClasificacion.DataSource = dst.Tables(0)
    '    ddlClasificacion.DataTextField = "NOMBRE"
    '    ddlClasificacion.DataValueField = "INDICE"
    '    ddlClasificacion.SelectedIndex = 0
    '    ddlClasificacion.DataBind()
    'End Sub


    'Private Sub fnCargarCombosClasificacion()
    '    Dim dst As DataSet
    '    Dim rsError As String
    '    Dim bOk As Boolean
    '    Dim oNegGlobalesCI As New srvNegGlobalesCI.srvNegGlobalesCI
    '    bOk = oNegGlobalesCI.fnObtenerNombresClasificacion(1, hidCompania.Value, dst, rsError)
    '    If bOk Then
    '        Dim dr As DataRow
    '        fnCargarComboClasificacion(Me.ddlClasificacion1, dst)
    '        fnCargarComboClasificacion(Me.ddlClasificacion2, dst)
    '        fnCargarComboClasificacion(Me.ddlClasificacion3, dst)
    '    Else
    '        Me.lblMensaje.Text = rsError
    '    End If
    'End Sub

    'Private Function fnValidaPagina()
    '    Dim items As ListItemCollection = Me.chkTipoArticulo.Items()
    '    Dim item As ListItem
    '    Dim bseleccionado = False

    '    For Each item In items
    '        If item.Selected Then
    '            bseleccionado = True
    '        End If
    '    Next
    '    If bseleccionado = False Then
    '        Me.lblMensaje.Text = C_MSG_RFV_TIPO_ARTICULO_SELECCIONADO
    '    End If
    '    Return bseleccionado
    'End Function

    'Private Sub btnBuscar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBuscar.Click
    '    If fnValidaPagina() Then
    '        fnCargarArticulos()
    '    End If
    'End Sub


    'Private Sub grdArticulos_PageIndexChanged(ByVal source As System.Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles grdArticulos.PageIndexChanged
    '    'oDvArticulos = Cache("dvw_Articulos")
    '    oDvArticulos = Session("dvw_Articulos")
    '    Me.grdArticulos.CurrentPageIndex = e.NewPageIndex
    '    EnlazarDatagrid(grdArticulos, oDvArticulos)
    'End Sub

    'Private Sub grdArticulos_SortCommand(ByVal source As System.Object, ByVal e As System.Web.UI.WebControls.DataGridSortCommandEventArgs) Handles grdArticulos.SortCommand
    '    Try
    '        'oDvArticulos = Cache("dvw_Articulos")
    '        oDvArticulos = Session("dvw_Articulos")
    '        If ViewState(e.SortExpression) Is Nothing Then
    '            oDvArticulos.Sort = New System.Text.StringBuilder().Append(e.SortExpression).Append(" asc").ToString
    '        Else
    '            If ViewState(e.SortExpression).Substring(ViewState(e.SortExpression).Length - 3, 3) = "asc" Then
    '                oDvArticulos.Sort = New System.Text.StringBuilder().Append(e.SortExpression).Append(" desc").ToString
    '            Else
    '                oDvArticulos.Sort = New System.Text.StringBuilder().Append(e.SortExpression).Append(" asc").ToString
    '            End If
    '        End If
    '        ViewState(e.SortExpression) = oDvArticulos.Sort
    '        EnlazarDatagrid(Me.grdArticulos, oDvArticulos)
    '    Catch ex As Exception
    '        CreateLogFiles()
    '        ErrorLog(Server.MapPath("Logs/ErrorLog"), ex.Message + ex.StackTrace)
    '    End Try
    'End Sub
    'Private Sub fnCambiarCaracteres(ByRef cadena As String)
    '    cadena = cadena.Replace("/", "//")
    '    cadena = cadena.Replace("\", "\\")
    'End Sub


    'Public Function fnCrearCadenaDevolucion(ByVal p1 As String, ByVal p2 As String, ByVal p3 As String, ByVal p4 As String, ByVal p5 As String, ByVal p6 As String, ByVal p7 As String, ByVal p8 As String, ByVal p9 As Double, ByVal p10 As Double) As String
    '    fnCambiarCaracteres(p5)
    '    fnCambiarCaracteres(p7)
    '    Return String.Format("javascript:DevolverValores('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}')", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10)

    'End Function


    'Private Sub lnkMostrar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lnkMostrar.Click
    '    If Me.lnkMostrar.Text = "Mostrar" Then
    '        lnkMostrar.Text = "Ocultar"
    '        Me.tblAvanzada.Visible = True
    '    Else
    '        lnkMostrar.Text = "Mostrar"
    '        tblAvanzada.Visible = False
    '    End If
    'End Sub
End Class
